//package org.magic.cloud.common.poi;
//
//import java.io.IOException;
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Map;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//import org.apache.log4j.Logger;
//import org.magic.cloud.common.poi.api.sheet.SheetContext;
//import org.magic.cloud.common.poi.api.totals.ColumnTotalsDataRange;
//import org.magic.cloud.common.poi.api.workbook.WorkbookContext;
//import org.magic.cloud.common.poi.impl.workbook.WorkbookContextFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.RequestMapping;
//
//import com.magic.cloud.common.filter.MagicPermission;
//import com.magic.cloud.common.service.BaseController;
//import com.magic.cloud.common.util.FileDownloadUtil;
//import com.magic.cloud.system.model.SysLog;
//
//@Controller
//@RequestMapping(value = "excel")
//public class ExcelDemoController extends BaseController {
//
//	private static final Logger logger=Logger.getLogger(ExcelDemoController.class);
//	
//	@Autowired
//	private WorkbookContextFactory ctxFactory;
//	
//	@MagicPermission
//	@RequestMapping(value = "excel")
//	public void excel(HttpServletRequest request,HttpServletResponse response) throws IOException{
//		Map<String, Object> params=getPageMap(request);
//		List<SysLog> datas=new ArrayList<SysLog>();
//		WorkbookContext workbookCtx = ctxFactory.createWorkbook();
//		SheetContext sheetCtx = workbookCtx.createSheet("Payments");
//		// heading
//		sheetCtx.nextRow().skipCell().header("OS").header("ExecuteTime").header("Creater").setColumnWidth(25)
//				.header("Description").setColumnWidth(35).header("Ip").setColumnWidth(35);
//		ColumnTotalsDataRange totalsData = sheetCtx.startColumnTotalsDataRangeFromNextRow();
//		// data
//		for (SysLog payment :datas) {
//			sheetCtx.nextRow().skipCell().text(payment.getOs()).number(payment.getExecuteTime())
//					.text(payment.getCreater()).text(payment.getDescription()).text(payment.getIp());
//		}
//		sheetCtx.nextRow().setTotalsDataRange(totalsData).header("Total:").total(org.magic.cloud.common.poi.api.totals.Formula.SUM);
//		FileDownloadUtil.download("日志表格-simple.xls", workbookCtx.toNativeBytes(), request, response);
//	}
//	
// }